//# sourceURL=http://uMapApp/Module/WorkManageModule/WorkManageModule
define([
    "mhjs/mhjs",
    "uMap/uMap",
    "uEarth/uEarth",
    "../Module",
    "../../UI/Panel/FloatPanel",
    "../../UI/Panel/PanelBlock/PanelBlock",
    "../../UI/Panel/PanelBlock/ListBlock",
    "../../UI/Panel/Item/EquipmentListItem"
    , "../../UI/Layer"
    , "./WorkManageIntroModule"
    , "./WorkAreaCameraModule"
    , "./StorehouseModule"
    , "../../UI/Panel/TitleMenuPanel"
    , "../../UI/TopMenu/TopMenus"
    , "../../UI/TopModuleMenu/TopModuleMenus"
], function (
    mhjs,
    uMap,
    uEarth,
    Module,
    FloatPanel,
    PanelBlock,
    ListBlock,
    EquipmentListItem
    , Layer
    , WorkManageIntroModule
    , WorkAreaCameraModule
    , StorehouseModule
    , TitleMenuPanel
    , TopMenus
    , TopModuleMenus
) {

    function WorkManageModule(option) {

        var _this = this;

        Module.call(_this, option);

        _this.title = "智慧工区智慧运营子系统";
        _this.icon = _this.app.icons.home;

        _this.mainTile = _this.app.layers.GIS.C3DTILE.G502022;
        _this.cargoTile = _this.app.layers.GIS.C3DTILE.G502022_cargo;
        _this.bimTile = _this.app.layers.GIS.C3DTILE.bim2022;
        _this.mainImage = _this.app.layers.GIS.IMAGERY.G502022_IMAGE;

        _this.titleMenuPanel = new TitleMenuPanel({
            "title": _this.title
        });

        _this.titleMenuPanel.ui.back.label = "返回";
        _this.titleMenuPanel.ui.back.icon = _this.app.icons.back;
        // _this.titleMenuPanel.append(_this.titleMenuPanel.menus);
        _this.app.ui.layout.top.append(_this.titleMenuPanel);

        _this.modules = {};

        _this.modules.workAreaCameraModule = new WorkAreaCameraModule({
            "app"           : _this.app,
            "parentModule"  : _this,
            "camerasRequest": _this.app.servers.DC.requests.sc_cameras
        });

        _this.modules.workManageIntroModule = new WorkManageIntroModule({
            "app"         : _this.app,
            "parentModule": _this
        });

        _this.modules.storehouseModule = new StorehouseModule({
            "app"                     : _this.app,
            "parentModule"            : _this,
            "featuresViewportsRequest": _this.app.servers.DC.requests.sc_featureViewport,
            "cargosRequest"           : _this.app.servers.DC.requests.sc_cargos
        });


        _this.titleMenuPanel.menus = new TopModuleMenus({
            "app" : _this,
            "list": [
                {
                    "module": _this.modules.workManageIntroModule
                },
                {
                    "module": _this.modules.storehouseModule
                }
            ]
        });

        _this.titleMenuPanel.append(_this.titleMenuPanel.menus);


    }

    var _class = WorkManageModule;

    mhjs.Inherit(_class, Module);

    Object.defineProperties(_class.prototype, {
        "open" : {
            value: function () {
                var _this = this;

                _this.titleMenuPanel.open();

                _this.app.main3DLayer.close();
                _this.mainTile.open();
                // _this.mainImage.open();

                _this.modules.workAreaCameraModule.open();

                if (!_this.activeModule) {
                    _this.modules.workManageIntroModule.menu.click();
                } else {
                    _this.activeModule.open();
                }

                _this.isOpened = true;

                _this.trigger("open");
                _this.trigger("toggle");
            }
        },
        "close": {
            value: function () {
                var _this = this;

                _this.app.main3DLayer.open();
                _this.mainTile.close();
                _this.mainImage.close();

                _this.titleMenuPanel.close();
                _this.activeModule.close();

                _this.modules.workAreaCameraModule.close();

                _this.isOpened = false;

                _this.trigger("close");
                _this.trigger("toggle");
            }
        }
    });

    return _class;

});